#/bin/bash


dbname=''
dbip=''
dbuser=''
dbpasswd=''

name=$1
if [ $name == "server" ];then
  dbname="testdb"
  dbip="127.0.0.1"
  dbuser="root"
  dbpasswd="Root_123"
fi

cp install.sh.bak install.sh

replaceName(){
  sed -i "s/db_name/${dbname}/g" install.sh
  sed -i "s/db_ip/${dbip}/g" install.sh
  sed -i "s/db_user/${dbuser}/g" install.sh
  sed -i "s/db_passwd/${dbpasswd}/g" install.sh
}

replaceName
